import React from 'react'
import { Redirect } from 'react-router-dom';

import JPDiscover from '@/pages/discover';
import JPFriend from '@/pages/friend';
import JPMine from '@/pages/mine';
import JPRecommend from '@/pages/discover/c_pages/recommend';
import JPRanking from '../pages/discover/c_pages/ranking';
import JPSongs from '../pages/discover/c_pages/songs';
import JPDjradio from '../pages/discover/c_pages/djradio';
import JPArtist from '../pages/discover/c_pages/artist';
import JPAlbum from '../pages/discover/c_pages/album';

const routes = [
  {
    path: '/',
    exact: true,
    render: () => {
      return  <Redirect to="/discover" />;
    }
  },
  {
    path: '/discover',
    component: JPDiscover,
    routes: [
      {
        path: '/discover',
        exact: true,
        render: () => {
          return <Redirect to="/discover/recommend" />;
        }
      },
      {
        path: '/discover/recommend',
        component: JPRecommend
      },
      {
        path: '/discover/ranking',
        component: JPRanking
      },
      {
        path: '/discover/songs',
        component: JPSongs
      },
      {
        path: '/discover/djradio',
        component: JPDjradio
      },
      {
        path: '/discover/artist',
        component: JPArtist
      },
      {
        path: '/discover/album',
        component: JPAlbum
      }
    ]
  },
  {
    path: '/friend',
    component: JPFriend
  },
  {
    path: '/mine',
    component: JPMine
  }
];

export default routes;
